<template>
  <!-- 
   -->
  <div>
    <button @click="isShow = !isShow"> 显示与隐藏</button>
    <transition>
      <div class="box" v-show="isShow"></div>
    </transition>
    <hr>
    <transition name="laoli">
      <div class="box" v-show="isShow"></div>
    </transition>
    

  </div>
</template>

<script>
export default {
  data() {
    return {
      isShow:true
    }
  },
}
</script>

<style scoped>
.box{
  width: 100px;
  height: 100px;
  background:tomato ;
}

/* 
动画元素在 进入时和离开后 是同一个样式
元素在 进入后和离开时 是同一个样式
*/
.v-enter,
.v-leave-to {
  opacity: 0;
}

.v-leave,
.v-enter-to{
  opacity: 1;
}

/* 
控制动画元素 在进入和离开的过程中
*/
.v-enter-active,
.v-leave-active{
  transition: all 3s linear;
}

/*
控制name为laoli元素的动画效果
*/
.laoli-leave,
.laoli-enter-to{
  opacity: 0;
  transform: translateX(50px);
}

.laoli-enter,
.laoli-leave-to{
  opacity: .7;
  transform: translateX(200px);
}

.laoli-enter-active,
.laoli-leave-active{
  transition: all 1s linear;
}


</style>